﻿//Juan Antonio Sanchez Arbos
//Mireya Rodríguez Santiago
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace PL___Windows_Inteface
{
    public partial class ContractForm : Form
    {
        private bool accepted = false;
        private int nmonths;
        private string type;

        public bool Accepted
        {
            get { return accepted; }
            set { accepted = value; }
        }
        public int NMonths
        {
            get { return nmonths; }
            set { nmonths = value; }
        }

        public ContractForm()
        {
            InitializeComponent();
        }
        
        public ContractForm(String contract,String type)
        {
            InitializeComponent();
            this.type = type;
            if (type.Equals("BUY"))
            {
                this.panelNMonths.Visible = false;
            }
            this.richTextBox1.SelectionColor = Color.Black;
            this.richTextBox1.Font = new Font("Arial", 12, FontStyle.Regular);
            this.richTextBox1.Text = "\n\t" + contract;
            this.richTextBox1.RightMargin = this.panelContract.Width - 20;
            this.richTextBox1.Left = 20;
            richTextBox1.SelectionAlignment = HorizontalAlignment.Center;
        }

        private void buttonAccept_Click(object sender, EventArgs e)
        {
            this.accepted = true;
            if (type == "LEASE")
            {
                this.nmonths = Convert.ToInt32(this.textBox1.Text);
            }
            this.Close();
        }

        private void buttonCancel_Click(object sender, EventArgs e)
        {
            this.accepted = false;
            this.Close();
        }
       
    }
}
